package com.sl.carcode.utils;

import android.content.Context;
import android.content.SharedPreferences;

import com.sl.carcode.global.MyApplication;


/**
 * Created by  raysh  on 2017/6/8.
 */

public class SPUtils {

    private static SharedPreferences search;

    public static void setString(String name, String str) {
        search = MyApplication.getContext().getSharedPreferences("CarCode", Context.MODE_PRIVATE);
        search.edit().putString(name, str).commit();
    }

    public static String getString(String name, String str) {
        search = MyApplication.getContext().getSharedPreferences("CarCode", Context.MODE_PRIVATE);
        return search.getString(name, str);
    }

    public static void setIsFirstStart(boolean isFirst) {
        search = MyApplication.getContext().getSharedPreferences("CarCode", Context.MODE_PRIVATE);
        search.edit().putBoolean("ISFirst", isFirst).commit();
    }

    public static boolean getIsFirstStart() {
        search = MyApplication.getContext().getSharedPreferences("CarCode", Context.MODE_PRIVATE);
        return search.getBoolean("ISFirst", true);
    }

}
